<?php
    /**
     * Created by PhpStorm.
     * User: zgh
     * Date: 2021-08-02
     * Time: 10:41
     */

    namespace app\common\model;


    use think\Model;

    class CrontabLogModel extends Model
    {
        protected $autoWriteTimestamp = true;

        const tableName = 'crontab_log';

        public function getCreateTimeAttr($value)
        {
            return date("Y-m-d H:i:s", $value);
        }

        public function getStatusTextAttr($value, $data)
        {
            if ($data['status'] == 0) {
                return '<span style="color: #FF5722">失败</span>';
            } else {
                return '<span style="color: #5FB878">成功</span>';
            }
        }


        public static function getMagicTableName()
        {
            return '__' . strtoupper(self::tableName) . '__';
        }
    }